﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RooHui.Infrastructure.Entities.Entity;
using RooHui.Infrastructure.Entities.EFContext;
using RooHui.Tool;

namespace RooHui.OA.Biz
{
    public class ResourceBiz
    {
        public static List<Resource> GetResourceListByProjectID(int projectId)
        {
            try
            {
                using (Context ctx = new Context())
                {
                    var reslist = from c in ctx.Resource where c.RefId == projectId
                                      orderby c.ID select c;
                    var data = reslist.ToList()
                        .Select(r => new Resource().Set(r)).ToList();
                    return data;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Write(CommonLogger.Web, ex);
            }
            return null;
        }
    }
}
